function CoverGuide(cover, target) {
    const body = document.body;
    const doc = document.documentElement;
    if (cover && target) {
        console.log('ccc', cover, target);
        //target size
        const targetWidth = target.clientWidth;
        const targetHeight = target.clientHeight;
        //page size
        // const pageWidth = doc.scrollWidth;
        // const pageHeight = doc.scrollHeight;
        //offset of target
        const offsetTop =
            target.getBoundingClientRect().top +
            (body.scrollTop || doc.scrollTop);
        const offsetLeft =
            target.getBoundingClientRect().left +
            (body.scrollLeft || doc.scrollLeft);
        // set size and border-width
        cover.style.width = targetWidth + "px";
        cover.style.height = targetHeight + "px";
        cover.style.top = offsetTop + "px";
        cover.style.left = offsetLeft + "px";

        const isShow = !localStorage.getItem("showedGuide");
        if (isShow) {
            cover.style.display = "block";
            localStorage.setItem("showedGuide", "true");
        }

        const tipBlock = document.querySelector(".guide-tip-block");
        if (isShow) tipBlock.style.display = "block";
        tipBlock.style.top = offsetTop  + "px";
        //resize
        if (!cover.isResizeBind) {
            window.addEventListener("resize", function() {
                CoverGuide(cover, target);
            });
            cover.isResizeBind = true;
        }
    }
}

export default { CoverGuide };
